package seo.dale.util.calculator.operation.factory;

import java.util.*;

import seo.dale.util.calculator.operation.*;

public class MapOperationFactory implements OperationFactory {

	Map<String, Operation> map = new HashMap<String, Operation>();
	
	public MapOperationFactory() {
		map.put("+", new AddOperation());
		map.put("-", new SubstractOperation());
		map.put("*", new MultiplyOperation());
		map.put("/", new DevideOperation());
	}
	
	@Override
	public Operation createOperationFor(String operator) {
		Operation operation = map.get(operator);
		return operation != null ? operation : new DummyOperation();
	}
	
}